This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SElECT articles_i18n.id AS id, published_at, title, body | |
FROM articles_i18n | |
INNER JOIN articles_i18n_translations ON article_id = articles_i18n.id | |
WHERE locale = "fr"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `articles_i18n` ( | |
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, | |
`published_at` datetime NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |
CREATE TABLE `articles_i18n_translations` ( | |
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, | |
`article_id` int(11) NOT NULL, | |
`locale` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `articles_i18n_simple` ( | |
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, | |
`published_at` datetime NOT NULL, | |
`title_en` varchar(2000) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', | |
`title_fr` varchar(2000) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', | |
`body_en` text COLLATE utf8mb4_unicode_ci, | |
`body_fr` text COLLATE utf8mb4_unicode_ci, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// default | |
body { font-family: sans-serif; } | |
:lang(en) { font-family: Times, serif; } | |
:lang(ar) { font-family: Tahoma, sans-serif; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p:lang(en)::before { | |
content: "Hello "; | |
} | |
p:lang(ar)::before { | |
content: "أهلاً ب"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `users` ( | |
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, | |
`email` varchar(1000) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; | |
CREATE TABLE `user_translations` ( | |
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, | |
`user_id` int(11) DEFAULT NULL, | |
`locale` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT users.id AS id, first_name, last_name, email | |
FROM users | |
JOIN user_translations | |
WHERE user_id = users.id | |
AND locale = "ar"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT id, name_en AS name | |
FROM users; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `users` ( | |
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, | |
`email` varchar(1000) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', | |
`name_en` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', | |
`name_ar` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html dir="<?php echo $dir?>" lang="<?php echo $locale?>"> | |
<head> | |
<!-- ... --> | |
<link rel="stylesheet" href="/framework.css" /> | |
<link rel="stylesheet" href="/app.css" /> | |
<?php if ($dir == 'rtl'): ?> | |
<link rel="stylesheet" href="/framewor-rtl.css" /> |